package com.aube.rvi.util;

/**
 * @author huyn
 * @version 2013-12-9 下午4:43:26
 */

public class StringUtils {

	public static boolean isBlank(String str) {
		int strLen;
        if (str == null || (strLen = str.length()) == 0) {
            return true;
        }
        if("null".equalsIgnoreCase(str))
        	return true;
        for (int i = 0; i < strLen; i++) {
            if ((Character.isWhitespace(str.charAt(i)) == false)) {
                return false;
            }
        }
        return true;
	}
	public static boolean isNotBlank(String str){
		return !StringUtils.isBlank(str);
	}

    public static String substringBeforeLast(String str, String separator) {
        if (isBlank(str) || isBlank(separator)) {
            return str;
        }
        int pos = str.lastIndexOf(separator);
        if (pos == -1) {
            return str;
        }
        return str.substring(0, pos);
    }

}

